<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="css/handerAndFooter.css">
    <link rel="stylesheet" type="text/css" href="css/admin.css">
    <link rel="stylesheet" type="text/css" href="css/shoppingindex.css">
    <style>
        .el-tabs__item {
            margin-bottom: 30px;
        }

        .el-tabs__active-bar {
            background-color: #E4E7ED;
        }
    </style>
</head>
<body>
<!--***************头部********************-->
<div>
    <el-container>
        <el-header style="padding: 0;height:90px;background-color: rgb(0, 149, 215); ">
            <!--            <div id="header-navbar"> 地平线8号 尽管出发 创造不凡</div>-->
            <!--            &lt;!&ndash;        ************************************&ndash;&gt;-->
            <div class="header222"
                 style="overflow:hidden;margin: 0 auto;padding-top:15px;width: 80%;    ">
                <div style="float: left ;
                     vertical-align: bottom;
                     padding-left: 20px;
                    margin-left: 3%;">
                    <h1 style="font-size: 35px;color: white">Level8 商城 后台管理系统</h1>
                    <!--        <el-menu-item index="3" disabled>消息中心</el-menu-item>-->
                    </el-menu>
                    <div class="line" style=""></div>

                </div>
                <div>
                    <a href="" style="margin-top: 20px;font-size: 15px;float: right;color: white">登录</a>
                </div>
                <div style="float: right;width: 50px;margin-top: 10px">
                    <img src="./img/people.png" class="iconimg1" style="width: 70%">
                </div>
            </div>
        </el-header>
        <el-main>
            <el-tabs :tab-position="tabPosition" style="height: 800px;margin-top: 20px">
                <el-tab-pane label="增加商品">
                    <!--增加商品的页面-->
                    <div class="product_addNew">
                        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" class="demo-ruleForm">
                            <el-form-item label="商品标题" prop="title">
                                <el-input v-model="ruleForm.title"></el-input>
                            </el-form-item>
                            <el-form-item label="商品的最新价格" prop="price">
                                <el-input v-model="ruleForm.price"></el-input>
                            </el-form-item>
                            <el-form-item label="商品的旧价格" prop="old_price">
                                <el-input v-model="ruleForm.old_price"></el-input>
                            </el-form-item>
                            <el-form-item label="商品图片" prop="url">
                                <el-input v-model="ruleForm.url"></el-input>
                            </el-form-item>
                            <el-form-item label="自定义排序序号" prop="sort">
                                <el-input v-model="ruleForm.sort"></el-input>
                            </el-form-item>
                            <el-form-item>
                                <el-button type="primary" @click="submitForm()">立即创建</el-button>
                                <el-button @click="resetForm('ruleForm')">重置</el-button>
                            </el-form-item>
                        </el-form>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="商品列表">
                </el-tab-pane>
                <el-tab-pane label="管理商品">
                    <!--管理商品的页面-->
                    <div class="product_set"></div>
                </el-tab-pane>
                <el-tab-pane label="商品分类">
                    <div class="brand_list">分类</div>
                </el-tab-pane>
                <el-tab-pane label="banner管理">
                    角色管理
                </el-tab-pane>
                <el-tab-pane label="管理admin用户">
                    定时任务补偿
                </el-tab-pane>
            </el-tabs>
        </el-main>
        <el-footer>
            <div id="footer" style="height: auto;">
                <div class="gmt-footer-bottom">
                    <!-- class="container" -->
                    <div style="margin-top: 10px">版权所有 ©2022 &nbsp;&nbsp;公司名：达内2203班
                        <a style="margin-left:10px;color: #000;" href="http://beian.miit.gov.cn">闽ICP备20000451号</a>
                    </div>
                </div>
            </div>
        </el-footer>
    </el-container>
    <div class="line"></div>
</div>
<!--*************************************尾部*************************-->
</div>
</body>
</html>
<script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>

    let v = new Vue({
        el: "body>div",
        data: function () {
            return {
                visible: false,
                tabPosition: 'left',
                prices: [],
                ruleForm: {
                    title: '',
                    price: '',
                    old_price:'',
                    url: '',
                    sort: ''
                },
                rules:{
                    title: [
                        { required: true, message: '请输入商品名称', trigger: 'blur' },
                        { min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' }
                    ],
                    name: [
                        { required: true, message: '请输入商品名称的拼音', trigger: 'blur' },
                        { min: 2, max: 25, message: '长度在 2 到 25 个字符', trigger: 'blur' }
                    ],
                    sort:[
                        {pattern:/^[1-9]{1}[0-9]?$/,message:'必须是0~99之间的数值',trigger:'blur'}
                    ]
                }
            }
        },


        methods: {
            submitForm(formName) {
                axios.post("/brands/add-new",v.ruleForm).then(function (response) {
                })
                // this.$refs[formName].validate((valid) => {
                //     if (valid) {
                //         let url='';
                //         console.log("url是:"+url);
                //         console.log(this.resetForm);
                //         axios.post("/brands/add-new",this.resetForm).then((response)=>{
                //             console.log("ftdfgiuhopf")
                //             console.log("接收到服务器的数据:"+response.data);
                //         })
                //     } else {
                //         console.log('error submit!!');
                //         return false;
                //     }
                // });
            },
            resetForm(formName) {
                this.$refs[formName].resetFields();
            },
            handleSelect(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClick(tab, event) {
                console.log(tab, event);

            }, handleOpen(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClose(key, keyPath) {
                console.log(key, keyPath);
            },
            handleSelect(key, keyPath) {
                console.log(key, keyPath);
            },
            car(id) {
                console.log("点击的是:" + id)
            }
        },
        created: function () {
            // axios.get("/admin/product/select").then(function (response) {
            //     v.prices = response.data;
            // })
        }


    })


</script>
